package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum DetailStatus {
	
	FAIL(0,"失败"),
	SUCCESS(1,"成功"),
	EXCEPTIONAL(2,"异常");
	
	
	private Integer value;
	private String text;

	private DetailStatus(Integer value,String text) {
		this.value = value;
		this.text = text;
	}

	public Integer toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static DetailStatus toStatus(Integer value) {
		if (FAIL.value == value) {
			return FAIL;
		} else if (SUCCESS.value == value) {
			return SUCCESS;
		} else if (EXCEPTIONAL.value == value) {
			return EXCEPTIONAL;
		}else {
			throw new InvalidArgumentException("Unknown DateilStatus[" + value + "].");
		}
	}
}
